home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TSPA2560.ARJ / TSUNTH.INT < prev    next >
Text File  |  1991-07-21  |  7KB  |  172 lines

  1. {$B-,D-,F-,I+,N-,R-,S+,V+}
  2.  
  3. (*
  4. Timo Salmi UNiT H
  5. A Turbo Pascal unit of system information and more miscellania
  6. All rights reserved 24-Feb-90
  7. Updated 15-Apr-90, 23-Jul-90, 1-Aug-90, 8-Aug-90, 5-Jan-90, 21-Jul-91
  8.  
  9. This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
  10. NON-INSTITUTIONAL purposes, provided it is not changed in any way. For
  11. ANY other usage, such as use in a business enterprise or a university,
  12. contact the author for the terms of registration.
  13.  
  14. The units are under development. Comments and contacts are solicited. If
  15. you have any questions, please do not hesitate to use electronic mail for
  16. communication.
  17. InterNet address: ts@chyde.uwasa.fi         (preferred)
  18. Funet address:    GADO::SALMI
  19. Bitnet address:   SALMI@FINFUN
  20.  
  21. The author shall not be liable to the user for any direct, indirect or
  22. consequential loss arising from the use of, or inability to use, any unit,
  23. program or file howsoever caused. No warranty is given that the units and
  24. programs will work under all circumstances.
  25.  
  26. Timo Salmi
  27. Professor of Accounting and Business Finance
  28. School of Business Studies, University of Vaasa
  29. P.O. BOX 297, SF-65101 Vaasa, Finland
  30. *)
  31.  
  32. unit TSUNTH;
  33.  
  34. (* ======================================================================= *)
  35.                           interface
  36. (* ======================================================================= *)
  37.  
  38. uses Dos
  39.      {$IFDEF VER40}
  40.      ,TSUNT45
  41.      {$ENDIF}
  42.      ;
  43.  
  44. (* ====================================================================
  45.                   Software information
  46.    ==================================================================== *)
  47.  
  48. (* Graftabl MsDos command loads the extended character set to be used in
  49.    the graphics mode.  This function tells whether the table has been
  50.    already loaded, or not *)
  51. function GRTABLFN : boolean;
  52.  
  53. (* This function returns whether a name is a directory or not *)
  54. function ISDIRFN (name : string) : boolean;
  55.  
  56. (* This function returns whether a text file is open or closed.
  57.                                    ^^^^
  58.    Naturally the FilePointer must have been assigned at an earlier stage.
  59.    Very convenient as a test in routines which close a file.
  60.    e.g. use: if OPENEDFN(f) then close(f);                                *)
  61. function OPENEDFN (var FilePointer : text) : boolean;
  62.  
  63. (* Returns the country code if MsDos 3+. For an error and earlier MsDos
  64.    versions returns zero. See MsDos manual "How to use Code Pages" for
  65.    the country codes *)
  66. function COUNTRFN : word;
  67.  
  68. (* Return the country-dependent date format, reguires 3.0+,
  69.    Principal return formats: MM-DD-YY       ('-' or whatever is the
  70.                              DD-MM-YY        relevant separator)
  71.                              YY-MM-DD
  72.    On error or MsDos < 3.0 returns ('XX*XX*XX');
  73.    Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
  74. function DATEFMFN : string;
  75.  
  76. (* Return the country-dependent time format, reguires 3.0+,
  77.    Principal return formats: 12-hour HH:MM:SS   (':' or whatever is the
  78.                              24-hour HH:MM:SS    relevant separator)
  79.    On error or MsDos < 3.0 returns ('00h');
  80.    Norton & Wilton ss. 358-360, 412, Duncan 395-398, Dettmann 586 *)
  81. function TIMEFMFN : string;
  82.  
  83. (* Returns from which drive the system was booted, requires MsDos 4.0+,
  84.    else returns '.' *)
  85. function BOOTDRFN : char;
  86.  
  87. (* ====================================================================
  88.                   Hardware information
  89.    ==================================================================== *)
  90.  
  91. (* Is a math coprocessor present. And, yes, yes, I know that there is a
  92.    Test8087 variable in Turbo Pascal, but I have found it unreliable *)
  93. function MATHCOFN : boolean;
  94.  
  95. (* Number of serial ports *)
  96. function RS232FN : byte;
  97.  
  98. (* Number of parallel ports (printers installed) *)
  99. function PARPORFN : byte;
  100.  
  101. (* Returns the type of the processor chip. If not known, returns the
  102.    string 'error'. This function is based on the public inline code in
  103.    Michael Tischer, PC System Programming for Developers, Abacus, p. 660.
  104.    I have written the interface to it. Does not detect 80486. Sometimes
  105.    gives conflicting information. Use with care, if at all. There are
  106.    alternatives *)
  107. function CHIPFN : string;
  108.  
  109. (* Get the version (date) of the ROM BIOS. It is of the format mm/dd/yy.
  110.    Returns 'NotKnown' if unavailable *)
  111. function ROMDTEFN : string;
  112.  
  113. (* Is the keyboard an enhanced keyboard *)
  114. function ISENHAFN : boolean;
  115.  
  116. (* Last drive of the system, softcoded, not for XTs *)
  117. function LASTDRFN : char;
  118.  
  119. (* This function gives the interleave factor of a given drive.
  120.    If you give a non-existent drive name, interlfn return zero.
  121.    This is for fixed disks. Applying on a floppy drive will give
  122.    nonsensical values, not for XTs. I am not convinced that this
  123.    works with all the different conrollers around *)
  124. function INTERLFN (drive : char) : byte;
  125.  
  126. (* Number of FATs, not for XTs *)
  127. function FATSFN (drive : char) : byte;
  128.  
  129. (* Number of cylinders on a device, requires MsDos 3.2+,
  130.    In case of modia not present, error, or MsDos < 3.2 returns 0 *)
  131. function NRCYLFN (drive : char) : byte;
  132.  
  133. (* ====================================================================
  134.                       Redirection status
  135.    ==================================================================== *)
  136.  
  137. (* Is the standard input from redirection. Based on PC-Mag Vol 10 No 7, 374,
  138.    Duncan 412, Dettmann 602-603 *)
  139. function PIPEDIFN : boolean;
  140.  
  141. (* Is the standard output redirected. Based on PC-Mag Vol 10 No 7, 374,
  142.    Duncan 412, Dettmann 602-603 *)
  143. function PIPEDOFN : boolean;
  144.  
  145. (* Is the standard output redirected to nul. Based on PC-Mag Vol 10 No 7, 374,
  146.    Duncan 412, Dettmann 602-603 *)
  147. function PIPEDNFN : boolean;
  148.  
  149. (* ====================================================================
  150.                       Perform tasks
  151.    ==================================================================== *)
  152.  
  153. (* Copy a file (of any type)
  154.    Status codes:
  155.    0 : ok
  156.    1 : FromFile does not exits
  157.    2 : ToFile already exists
  158.    3 : ToFile cannot be opened for writing (read-only,
  159.          write protected, invalid device)
  160.    4 : Error in writing to ToFile
  161.    5 : Copy error (disk probably full)
  162.    6 : Date stamp error
  163.    7 : Out of memory
  164. *)
  165. procedure COPYFILE (FromFile, ToFile : string; var status : byte);
  166.  
  167. (* Convert an Asciiz (#0 limited) string into an ordinary ascii string.
  168.    Some of the routines in this unit internally need Z2ASCFN, but why
  169.    not make it also generally available as well *)
  170. function Z2ASCFN (asciiz : string) : string;
  171.  
  172.